﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using System.Configuration;
using Ext.Net;
namespace TCDC_System.UserControl
{
    public partial class PaymentInfoAdd : System.Web.UI.UserControl
    {
        private tcdc_trn_payment_info obj;

        protected void Page_Load(object sender, EventArgs e)
        {
            obj = new tcdc_trn_payment_info();
            obj.strConn = ConfigurationManager.AppSettings["ConnString"];
        }

        public void Show()
        {
            WindowPaymentInfoAdd.Show();
        }

        protected void SavePaymentInfo(object sender, DirectEventArgs e)
        {
            obj.invoice_no = txt_invoice_no.Text;
            obj.payment_date = txt_payment_date.Text;
            obj.user_id = Convert.ToInt32(txt_user_id.Text);
            obj.payment_name = txt_payment_name.Text;
            obj.payment_address = txt_payment_address.Text;
            obj.province = txt_province.Text;
            obj.post_code = txt_post_code.Text;
            obj.payment_method = txt_payment_method.Text;
            obj.bank_name = txt_bank_name.Text;
            obj.bank_branch = txt_bank_branch.Text;
            obj.budget_year = Convert.ToInt32(txt_budget_year.Text);
            obj.payment_no = Convert.ToInt32(txt_payment_no.Text);
            obj.cancel_status = txt_cancel_status.Text;
            obj.cancel_desc = txt_cancel_desc.Text;
            obj.create_date = txt_create_date.Text;
            obj.create_by = Convert.ToInt32(txt_create_by.Text);
            obj.update_date = txt_update_date.Text;
            obj.update_by = Convert.ToInt32(txt_update_by.Text);
            obj.site_id = Convert.ToInt32(txt_site_id.Text);
            obj.insertData(obj);
            GridStore.DataSource = obj.getByObject(new tcdc_trn_payment_info());
            GridStore.DataBind();
            FormPanel1.Reset();
            WindowPaymentInfoAdd.Hide();
        }
        public Store GridStore { get; set; }
    }
}

